package com.hxk;

import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
/**
 * 异常日志处理队列
 * @author Cactus
 */
@Component
@RabbitListener(
		bindings=@QueueBinding(
				//配置交换器
				exchange=@Exchange(value="${mq.config.exchange}",type=ExchangeTypes.TOPIC),
				//配置路由键
				key="*.log.error",
				//配置队列名称
				value=@Queue(value="${mq.config.queue.error}",autoDelete="true")
		)
)
public class ErrorConsumer {

	/**
	 * 接收消息
	 * @param msg
	 */
	@RabbitHandler
	public void process(String msg){
		System.out.println("......Error........receiver:"+msg);
	}
}
